package com.elbis.access.wg.api.request.account;

import com.elbis.access.wg.api.request.WOTRequestEntity;

public class AccountList extends WOTRequestEntity {

	private static final long serialVersionUID = -1037134733341085811L;

	private String language = null;

	private String fields = null;

	private String type = null;

	private String search = null;

	private Long limit = null;

	public AccountList(String applicationId, String searchKeyword) {
		super(applicationId);
		search = searchKeyword;
	}

	/**
	 * @return the language
	 */
	public String getLanguage() {
		return language;
	}

	/**
	 * @param language
	 *            the language to set
	 */
	public void setLanguage(String language) {
		if (language != null) {
			language = language.toLowerCase();
		}
		this.language = language;
	}

	/**
	 * @return the fields
	 */
	public String getFields() {
		return fields;
	}

	/**
	 * @param fields
	 *            the fields to set
	 */
	public void setFields(String fields) {
		this.fields = fields;
	}

	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * @return the search
	 */
	public String getSearch() {
		return search;
	}

	/**
	 * @param search
	 *            the search to set
	 */
	public void setSearch(String search) {
		this.search = search;
	}

	/**
	 * @return the numeric
	 */
	public Long getLimit() {
		return limit;
	}

	/**
	 * @param limitNumber
	 *            the numeric to set
	 */
	public void setLimit(Long limitNumber) {
		this.limit = limitNumber;
	}

	@Override
	public String toHttpRequestParameters() {
		StringBuilder builder = new StringBuilder(
				super.toHttpRequestParameters());
		if (language != null) {
			builder.append("&");
			builder.append("language=");
			builder.append(language);
		}
		if (fields != null) {
			builder.append("&");
			builder.append("fields=");
			builder.append(fields);
		}
		if (type != null) {
			builder.append("&");
			builder.append("type=");
			builder.append(type);
		}
		if (search != null) {
			builder.append("&");
			builder.append("search=");
			builder.append(search);
		}
		if (limit != null) {
			builder.append("&");
			builder.append("limit=");
			builder.append(limit);
		}

		return builder.toString();
	}

	@Override
	public String toString() {
		return toHttpRequestParameters();
	}

}
